<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script>
	var FlyWeight = {
		moveX: function(x){
			this.x = x;
		},
		moveY: function(y){
			this.y = y;
		}
	}

	// 游戏角色继承移动的方法
	var Player = function(x,y){
		this.x = x;
		this.y = y;
	}
	Player.prototype = FlyWeight;

	// 游戏精灵继承移动的方法
	var Spirit = function(x,y){
		this.x = x;
		this.y = y;
	}
	Spirit.prototype = FlyWeight;

	</script>
</body>
</html>